<template>
  <section style="display:inline-block">
    <template>
      <slot v-if="showBtn()"></slot>
      <slot v-if="!showBtn()"
            name='label'></slot>
    </template>
  </section>
</template>
<script>
export default {
  name: 'permission-control',
  props: {
    permission: {
      type: String,
      default: ''
    }
  },
  data () {
    return {}
  },
  computed: {
    operations () {
      return this.$store.state.menu.operations
    }
  },
  methods: {
    showBtn () {
      return this.operations.some(ele => ele == this.permission)
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
